<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Type extends Model
{
  /**
   * Insert validation rules.
   *
   * @var array
   */
  public static $insertRules = [
    'type' => 'required|max:255|unique:types',
    'active' => 'nullable|boolean',
    // 'catalog_id' => 'required|int',
  ];

  /**
   * Update validation rules.
   *
   * @var array
   */
  public static $updatetRules = [
    'type' => 'required|max:255|unique:types',
    'active' => 'nullable|boolean',
    // 'catalog_id' => 'nullable|int',
  ];

  /**
   * The attributes that are mass assignable.
   *
   * @var array
   */
  protected $fillable = [
    'type',
    'active',
    // 'catalog_id',
  ];

  /**
   * The attributes excluded from the model's JSON form.
   *
   * @var array
   */
  protected $hidden = [
    // 'catalog_id',
  ];

  /**
   * The attributes that should be cast to native types.
   *
   * @var array
   */
  protected $casts = [];

  /**
   * Relationship with addresses.
   */
  public function addresses()
  {
    return $this->hasMany(Address::class);
  }

  /**
   * Relationship with telephones.
   */
  public function telephones()
  {
    return $this->hasMany(Telephone::class);
  }

  /**
   * Relationship with emails.
   */
  public function emails()
  {
    return $this->hasMany(Email::class);
  }

  /**
   * Relationship with pictures.
   */
  public function pictures()
  {
    return $this->hasMany(Picture::class);
  }
}
